<?php

$spaceMessageStr = Yii::t('site', 'spaceMessage');
$manageMemberStr = Yii::t('site', 'manageMember');
$appStoreStr = Yii::t('site', 'appStore');
return array(
    'basePath' => 'application.application.app.BPersonalApp',
    'paths' => array(
        'basePath' => 'application.application.app.BPersonalApp',
        'configPath' => 'config',
        'viewPath' => 'ui.themes.pc_bootstrap.views'
    ),
    'imports' => array(
        'classes' => 'classes',
        'uiPath' => 'ui',
        'screen' => 'ui.screens',
        'model' => 'ui.models',
        'operation' => 'operation',
        'operationFlow' => 'operationFlow',
    ),
    'preLoad' => array(
        'app' => array(
            'BAppCommon' => array(
            )
        )
    ),
    'appMeta' => array(
        'appName' => 'PersonalApp',
        'appClass' => 'BPersonalApp',
        'description' => 'Personal App',
        'relationship' => array(
            'space' => array(
                //means current app is invisible in all appstore in all space
                BSpace::All => BRelationshipGroup::Space_App_Relationship . "." . BRelationship::app_invisible_in_space)),
        'ui' => array(
        //'class'=>'', if not set class, use BUIApp
        //'layoutView'=>array('name','data'),
        //'views' => array(
        //'appTopBar' => array('spaceEngineTopBar'),
        //'appTopBar' => array('app_topBar'),
        //'),
        /*
          'screen' => array(
          //'class'=>'', if defined class, use defined class for screen, otherwise, use BUIScreen
          //'layout'=>'', if not set layout, use default
          'views' => array(//define views show in layout
          'topBar' => array('spaceEngineTopBar') // format: viewName => array(viewFileName,viewData = null)
          )
          ),
         * 
         */
        //'screenFlow'=>array()
        ),
        'operations' => array(
            'createSpace' => array(
                'displayName' => 'Create Space',
                //'class'=>'',//if class is not boperation, specify it here
                'permit' => array(
                    BPermit::AllowAccess => BRole::All_Roles,
                ),
                'startScreen' => array(
                    'views' => array(
                        'screenTopBar' => 'screen_topBar',
                        'createSpace' => 'createSpaceWithMeta')
                )
            ),
            'joinSpace' => array(
                'displayName' => 'Join Space',
                'permit' => array(
                    BPermit::AllowAccess => BRole::All_Roles,
                ),
//                'startScreen' => 'BScreenJoinSpace'),
                'startScreen' => array(
                    'views' => array(
                        'joinSpaceEntry' => 'joinSpaceEntry')
                ),
                'messenger' => array(
                    'receiveMessages' => array(
                        'spaceIncomeMessage' => array(
                            //'message' => 'BMGSpaceMessage',
                            'receiver' => array(
                            //if ignoe, will use permit for operation
                            //'permit' => array('allowSendMessage' => BRole::All_Roles)                     
                            //if not specify circle or user, default is all user allow for operation
                            ),
                            'message_from' => array(
                            //if not specify space, use current space
                            //'space' => BMessage::Message_To_Current_Space,
                            //if not specify app, use current app
                            //'app' => BMessage::Message_To_Current_App,
                            //'operation' => 'applyJoinSpace'
                            )
                        )
                    ),
                    'sendMessages' => array(
                        'spaceOutMessage' => array(
                            //'message' => 'BMGSpaceMessage',
                            'sender' => array(
                            //if ignor, use operation permit
                            //'permit' => array('allowReceiveMessage' => BRole::All_Roles)
                            ),
                            'message_to' => array(
                            //if not specify space, use current space
                            //'space' => BMessage::Message_From_Current_App,
                            //if not specify app, use current app
                            //'app' => BMessage::Message_From_Current_App,
                            //'operation' => 'applyJoinSpace'
                            )
                        )
                    )
                )
            ),
            'mySpaces' => array(
//                'displayName' => 'My Spaces',
                'displayName' => Yii::t('site', 'My Spaces'),
                'permit' => array(
                    BPermit::AllowAccess => BRole::All_Roles,
                ),
//                'startScreen' => 'BScreenMySpaces'),
                'startScreen' => array(
                    'views' => array(
                        'mySpaces' => 'mySpaces')
                )),
            'applyJoinSpace' => array(
                'displayName' => 'Join Space',
                'permit' => array(
                    'allowAccess' => BRole::All_Roles
                ),
                'startScreen' => array(
                    'views' => 'joinSpace'
                ),
                'messenger' => array(
                    'applyJoinSpace' => array(
                        'receiver' => array(
                            'operation' => 'BSpaceEngine:manageMember',
                            'message' => 'processJoinSpace'
                        ),
                        //define who can call this message
                        //here means all operation in current space
                        'allow_sender' => array(
                            array(
                                'app' => '*',
                                'operation' => '*',
                            //'app' => BAddress::from_all_app,
                            //'operation' => BAddress::from_all_operation,
                            //'user' => BAddress::from_all_user
                            )
                        ),
                        'allow_to' => array(
                            'operation' => 'BSpaceEngine:manageMember',
                            'message' => 'processJoinSpace'
                        )
                    ),
                )
            ),
        ),
    ),
    'db' => array(
        'connection' => array(
            'default' => 'blyndb',
            'localdb' => array(
                'connectString' => 'mysql:host=localhost;dbname=bilynapp',
                'user' => 'blndba',
                'password' => 'blnpwd'
            ),
            'blyndb' => array(
                'connectionString' => 'mysql:host=localhost;dbname=bilyn',
                'emulatePrepare' => true,
                'username' => 'test',
                'password' => 'password',
                'charset' => 'utf8',
                'tablePrefix' => 'tbl_',
                'enableParamLogging' => true,
            ),
        )
    ),
);
